package com.itic.codeGen.codeGenerator.workLine.implement;

import java.util.ArrayList;
import java.util.List;

import com.itic.codeGen.codeGenerator.util.CommonUtils;
import com.itic.codeGen.codeGenerator.util.CommonUtils.FILE_TYPE;
import com.itic.codeGen.codeGenerator.workLine.PartGenerator;

public class DaoImplGenerator implements PartGenerator {

    private static final String COMPONENT = "org.springframework.stereotype.Component";
    private static final String Annotation = "@Component";

    private String baseImplClz;
    private String domainName;
    private String packageName;
    private ArrayList<String> imports = new ArrayList<String>();
    private ArrayList<String> headers = new ArrayList<String>();
    private String extend;
    private ArrayList<String> implement = new ArrayList<String>();

    public DaoImplGenerator(String baseImplClz, String domainName, String packageName) {
	super();
	this.baseImplClz = baseImplClz;
	this.domainName = domainName;
	this.packageName = packageName;
    }

    @Override
    public List<String> getImports() {
	imports.add(COMPONENT);
	imports.add(baseImplClz + CommonUtils.PKG_SPLITER + domainName
	        + CommonUtils.BASE_IMPL);
	imports.add(CommonUtils.packageFomatter(packageName, FILE_TYPE.DAO)
	        + CommonUtils.PKG_SPLITER + domainName
	        + FILE_TYPE.DAO.getType());
	return imports;
    }

    @Override
    public List<String> getHeaders() {
	headers.add(Annotation);
	return headers;
    }

    @Override
    public String getExtend() {
	extend = domainName + CommonUtils.BASE_IMPL;
	return extend;
    }

    @Override
    public List<String> getImplement() {
	implement.add(domainName + FILE_TYPE.DAO.getType());
	return implement;
    }

    @Override
    public List<String> getBody() {
	return null;
    }

    @Override
    public String getXMLName() {

	return null;
    }

    public String getBaseImplClz() {
	return baseImplClz;
    }

    public void setBaseImplClz(String baseImplClz) {
	this.baseImplClz = baseImplClz;
    }

    public String getDomainName() {
	return domainName;
    }

    public void setDomainName(String domainName) {
	this.domainName = domainName;
    }

    public String getPackageName() {
	return packageName;
    }

    public void setPackageName(String packageName) {
	this.packageName = packageName;
    }

    public void setImports(ArrayList<String> imports) {
	this.imports = imports;
    }

    public void setHeaders(ArrayList<String> headers) {
	this.headers = headers;
    }

    public void setExtend(String extend) {
	this.extend = extend;
    }

    public void setImplement(ArrayList<String> implement) {
	this.implement = implement;
    }

}
